/*
 * @Description: 首页搜索栏
 * @Author: iamsmiling
 * @Date: 2021-06-08 06:40:27
 * @LastEditTime: 2021-06-09 14:56:15
 */
import 'package:credit_business_circle/R/R.dart';
import 'package:credit_business_circle/routes/app_routes.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class HomeSearchBar extends StatelessWidget {
  const HomeSearchBar({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.only(left: R.dimen.dp13, right: R.dimen.dp2),
      decoration: BoxDecoration(
          color: R.color.ffffffff,
          borderRadius: BorderRadius.circular(R.dimen.sp15)),
      child: TextField(
        readOnly: true,
        onTap: () => Get.toNamed(AppRoutes.search),
        decoration: InputDecoration(
            prefixIcon: Image.asset(R.image.search),
            suffixIconConstraints: BoxConstraints(
                maxHeight: R.dimen.dp28,
                minHeight: R.dimen.dp28,
                maxWidth: R.dimen.dp56,
                minWidth: R.dimen.dp56),
            suffixIcon: Container(
              alignment: Alignment.center,
              margin: EdgeInsets.only(right: R.dimen.dp4),
              constraints: BoxConstraints(
                  maxHeight: R.dimen.dp28,
                  minHeight: R.dimen.dp28,
                  maxWidth: R.dimen.dp56,
                  minWidth: R.dimen.dp56),
              decoration: BoxDecoration(
                  gradient: LinearGradient(
                      colors: [R.color.ff1bbd8d, R.color.ff14ca94]),
                  borderRadius: BorderRadius.circular(R.dimen.sp15)),
              child: Text(
                "搜索",
                textAlign: TextAlign.center,
                style:
                    TextStyle(fontSize: R.dimen.sp11, color: R.color.ffffffff),
              ),
            ),
            prefixIconConstraints: BoxConstraints(
                minHeight: R.dimen.dp12, maxHeight: R.dimen.dp12),
            hintText: "  请输入关键词搜索，找渠道、资源搜您想要的！"),
      ),
    );
  }
}
